package com.gengzp.rpc.context;

import com.alibaba.ttl.TransmittableThreadLocal;

/**
 * @ClassName RemoteTransactionalContextHolder
 * @Description 远程事务线程上下文控制对象
 * @Author gengzp
 * @Date 2025/8/11 20:23
 */
public class RemoteTransactionalContextHolder {

    // 请求唯一标识
    private static final ThreadLocal<String> requestId = new TransmittableThreadLocal<>();

    /**
     * 获取当前请求唯一标识
     */
    public static String getCurrentRequestId() {
        return requestId.get();
    }

    /**
     * 赋值当前请求唯一标识
     * @param str 请求唯一标识字符串
     */
    public static void setRequestId(String str) {
        requestId.set(str);
    }

}
